package org.jdcenter.rmi.impl;

import java.lang.reflect.Method;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdcenter.rmi.abs.Argument;
import org.jdcenter.rmi.impl.LocalChannelFactory.LocalObject;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

public class RMIInterceptor implements MethodInterceptor{
	
	private Log log = LogFactory.getLog(getClass());
	
	private LocalObject channel;
	public RMIInterceptor(LocalObject channel){
		this.channel = channel;
	}

	@Override
	public Object intercept(Object arg0, Method arg1, Object[] arg2,
			MethodProxy arg3) throws Throwable {
		log.debug("Intercept>>");
		return channel.invoke(arg1.getName(),arg2, null);
	}

}
